PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPSetTimerNotify

Sets the notification information associated with a timer.

OSStatus MPSetTimerNotify (
                     MPTimerID timerID,
                     MPOpaqueID notificationID,
                     void *notifyParam1,
                     void *notifyParam2,
                     void *notifyParam3);
timerID
A value of type MPTimerID that specifies the ID of the timer whose notification information you want to set.
notificationID
A value specifying the ID of the notification mechanism to associate with the timer. This value should be the ID of an event group, a message queue, or a semaphore.
notifyParam1
If notificationID specifies an event group, this parameter should contain the flags to set in the event group when the timer expires. If notificationID specifies a message queue, this parameter should contain the first 32-bits of the message to be sent to the message queue when the timer expires.
notifyParam2
If notificationID specifies a message queue, this parameter should contain the second 32-bits of the message to be sent to the message queue when the timer expires. Pass NULL if you don't need this parameter.
notifyParam3
If notificationID specifies a message queue, this parameter should contain the third 32-bits of the message sent to the message queue when the timer expires. Pass NULL if you don't need this parameter.
function result
A result code. See Result Codes for a list of possible values.
DISCUSSION

When the timer expires, Multiprocessing Services checks the notification ID, and if it is valid, notifies the related notification mechanisms (that is, event groups, queues, or semaphores) you had specified in your MPSetTimerNotify calls.

You can specify multiple notification mechanisms by calling this function several times. For example, you can call MPSetTimerNotify to specify a message queue and then call it again to specify a semaphore. When the timer expires, a message is sent to the message queue and the appropriate semaphore is signaled. You cannot, however, specify more than one notification per notification mechanism (for example, if you call MPSetTimerNotify twice, specifying different messages or message queues in each call, the second call will overwrite the first). Note that if a call to MPSetTimerNotify returns an error, any previous calls specifying the same timer are still valid; previously set notifications will still be notified when the timer expires.

You can set the notification information at any time. If the timer is armed, it will modify the notification parameters dynamically. If the timer is disarmed, it will modify the notification parameters to be used for the next MPArmTimer call.

VERSION NOTES

Introduced with Multiprocessing Services 2.0.


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)